//
//  Emoticon.swift
//  01-表情键盘
//
//  Created by mac on 16/4/21.
//  Copyright © 2016年 itheima. All rights reserved.
//

import UIKit

class Emoticon: NSObject {

    var chs: String?
    var png: String?
    var code: String?{
        didSet{
            //
            emoji = code?.emoji
        }
    }
    
    var emoji :String?
    
    //图片的完整路径
    var imageUrl: String {
        
        if png == nil {
            return ""
        }
        return NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + png!
    }
    
    //添加是否删除按钮
    var isRemoved = false
    
    init(isRemoved:Bool) {
        self.isRemoved = isRemoved
    }
    
    //添加是否删除按钮
    var isEmpty = false
    
    init(isEmpty:Bool) {
        self.isEmpty = isEmpty
    }
    
    //使用KVC
    init(dict: [String: AnyObject]) {
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) { }
    
    //重写description方法
    
    override var description: String {
        
        let key = ["chs","png","code"];
        
        return dictionaryWithValuesForKeys(key).description
    }
}


